import time
def sortirovka(b):
    f = open(b)
    a = [int(el.strip()) for el in f.readlines()]
    f.close()
    start = time.time()
    for i in range(len(a) - 1):
        for j in range(len(a) - 1 - i):
            if a[j] > a[j + 1]:
                a[j], a[j + 1] = a[j + 1], a[j]
    finish = time.time()
    t = (round(finish - start) * 1000)
    print(b[:-4], t, "milliseconds")
    
sortirovka("m1_sorted.txt")
sortirovka("m2_reverse.txt")
sortirovka("m3_shuffle.txt")